
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<link href="/static/css/default.css" rel="stylesheet" type="text/css">
<link href="/static/css/style/green.css" rel="stylesheet" type="text/css" id = 'link'>
<link href="/static/js/datepicker/css/bootstrap-datepicker.css" rel="stylesheet">  
</head>

<body style="padding:15px 8px 0px 8px;" >



<div class="classify">{$parenttitle}</div>
<!--toolbar start-->
<ul class="toolbar">
	<li><a href="#" class="selected"  id="add"><i class="toolico iconfont">&#xe649;</i>添加</a></li>
 

</ul>
<!--toolbar end-->

<!--tablebox start-->
<div class="tablebox"  id="main">
			
	<table>
    
    	<thead>
            <th class="num"></th>
            <th>标题</th>
            <th>图片</th>
            <th>描述</th>
            <th>日期</th>
            <th>类型</th>
			<th>综合评分</th>
           <th>操作</th>
        </thead>
        
        <tbody>
        
      
            <tr  v-for="uitem in arrayData">
                <td><input type="checkbox"></td>
                
                <td>{{uitem.title}}</td>
				<td><img width="50px" v-bind:src="'/static/uploads/'+uitem.imgurl"></td>
                <td>{{uitem.desc}}</td>
                <td>{{uitem.mydate}}</td>
				  <td>{{uitem.type}}</td>
				  <td>{{uitem.avgnum}}</td>
                 <td>	
                	<div class="am-btn-toolbar">
                    <div class="am-btn-group am-btn-group-xs">
                     
                      <a  v-on:click="vupdate(uitem)"  >修改</a>
                      <a  v-on:click="vdel(uitem)" >删除</a>
                    </div>
                  </div>
                </td>
              </tr>
            </tr>
            
          
                        
        </tbody>        
    
    </table>
	
	<div class="pagination">
	

		<vue-nav :cur="cur" :all="all" :allcount="allcount" :callback="callback"></vue-nav>   
		 
    
    
  
</div>
</div>
<!--tablebox end-->

<!--pagination start-->


<!--pagination end-->

</body>
<script type="text/javascript" src="/static/js/jquery.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script>

<script src="/static/js/layer/layer.js"></script>

<script type="text/javascript" src="/static/js/vue2.js"></script>
<script type="text/javascript" src="/static/js/vue-nav.js"></script>
<script>
var vm = new Vue({
                el: "#main",
                data: {
					cur: 1,
					all: 0,
					size:10,
					allcount:0,
					arrayData: [],
					
				},
				components:{
				  'vue-nav': Vnav
			    },
                methods: {
                    getdata: function (_keycontent) {  //查询数据
					
						var self = this;
                         $.get("/Index/daily/getFood", {page: self.cur ,size : self.size}, function (_result) {
                            self.arrayData = _result.list;
							self.all =_result.count;
							self.allcount= _result.allcount
                        });
                       
                    },
					callback:function(data) {
					
						var self = this;
						this.cur = data;
			
						$.get("/Index/daily/getFood", {page: self.cur ,size : self.size}, function (_result) {
                           
							self.arrayData = _result.list;
							self.all =_result.count;
							self.allcount= _result.allcount
                        });
					},
					vupdate: function (uitem) {

                        //***************获取数据的方法1，使用jquery获取*****************
                       
						  parent.layer.open({
						  type: 2,
						  title: '信息修改',
						  fixed: false, //不固定
						  maxmin: true,
						  area: ['700px', '600px'],
						  content: '/Index/daily/Foodadd?id='+uitem.id
						}); 

                    },
					vdel:function(uitem){
						var self = this;
						parent.layer.confirm('确定要删除吗?', {
						  btn: ['是','否'] //按钮
						}, function(){
							$.post("/Index/daily/Fooddel",{"id": uitem.id},function(data){
							parent.layer.closeAll('dialog');
								if(data.status==200){
									layer.msg(data.message);
									self.getdata("");
								}else{
									layer.msg(data.message);
								}
							});
						}, function(){
						 
						});
						
					}
                },
                created: function () {  //初始化事件里边去调用查询方法
                   this.getdata("");
                }
 });

	!function(){
		$('#add').on('click', function(){
				
			  parent.layer.open({
			  title:'信息添加',
			  type: 2,
			  area: ['700px', '600px'],
			  fixed: false, //不固定
			  maxmin: true,
			  content: '/Index/daily/Foodadd'
			}); 
	});
	}();
</script>
</html>
